@tool
class_name EntityData_Weapon
extends EntityData

#region 属性
#endregion
#region 字段
@export_group("Attribute")
@export var weapon_id:String
@export var weapon_name:String
@export var weapon_desc:String
@export_group("")
@export_group("Camp")
@export var default_camp:GameEnum.Camp = GameEnum.Camp.None:
	get:
		return default_camp
	set(value):
		default_camp = value
		data_changed.emit("attribute","default_camp")
@export_group("")
@export_group("Anim")
@export var default_anim_name:String = "idle":
	get:
		return default_anim_name
	set(value):
		default_anim_name = value
@export_group("")
@export_group("Other")
@export var sprite:Texture2D:
	get:
		return sprite
	set(value):
		sprite = value
@export_group("")
#endregion
#region 信号
#endregion
#region 运行时属性
#endregion

#region 基类方法
## 初始化运行时属性
func init(entity:Entity):
	if inited:
		return
	super(entity)
	## 初始化属性
	add_attribute_value("Camp",CompositeProperty.PropertyType.Camp,default_camp)
	
func _on_attribute_changed(attribute:Attribute,old_value,new_value):
	super(attribute,old_value,new_value)
func _on_data_changed(tag_space:String,tag:String,old_value,new_value):
	super(tag_space,tag,old_value,new_value)
#endregion
#region 公共方法
#endregion
#region 私有方法
#endregion
#region 生命周期函数
func _init() -> void:
	super()
	if Engine.is_editor_hint():
		if not attribute_set:
			attribute_set = AttributeSet.new()
		attribute_set.resource_local_to_scene = true
#endregion
